import { CellGroup, Dialog, Field, Switch } from "vant";
import { defineComponent, ref, toRef, toRefs } from "vue";
import type { PropType } from "vue";
import type { ShowDialogType, Task } from "@/views/Home/hook";

const SchedulerDialog = defineComponent({
  props: {
    showDialog: {
      type: Object as PropType<ShowDialogType>,
      required: true,
    },
    task: {
      type: Object as PropType<Task>,
      required: true,
    },
  },
  setup(props, { emit }) {
    return () => (
      <div>
        <Dialog title={"Detail"} v-model:show={props.showDialog.show}>
          <CellGroup inset>
            <Field
              v-model={props.task.content}
              name={"content"}
              label={"内容"}
              rules={[{ required: true, message: "内容不能为空" }]}
            />
            <Field
              v-model={props.task.createTime}
              name={"createTime"}
              label={"创建时间"}
              disabled
            />
            <Field name={"status"} label={"状态"} disabled>
              {{
                input: () => (
                  <Switch v-model={props.task.status} size={"20px"} />
                ),
              }}
            </Field>
          </CellGroup>
        </Dialog>
      </div>
    );
  },
});

export default SchedulerDialog;
